import requestProxy from '@/utils/request';
const { request } = requestProxy;

// 开票申请-列表
export function getIssueInvoiceList(params, cancelToken) {
  return request({
    url: 'admin/issue/invoice/list',
    method: 'get',
    params,
    cancelToken
  });
}

// 开票申请-tab列表
export function getIssueInvoiceTabs(params) {
  return request({
    url: 'admin/issue/invoice/tab',
    method: 'get',
    params
  });
}

// 开票申请-删除
export function deleteIssueInvoice(id) {
  return request({
    url: `admin/issue/invoice/delete/${id}`,
    method: 'delete'
  });
}

// 开票申请-发起
export function storeIssueInvoice(data) {
  return request({
    url: 'admin/issue/invoice/store',
    method: 'post',
    data
  });
}

// 开票申请-编辑
export function editIssueInvoice(data) {
  return request({
    url: `admin/issue/invoice/edit/${data.id}`,
    method: 'put',
    data
  });
}

// 开票申请-详情
export function getIssueInvoiceDetail(id, params) {
  return request({
    url: `admin/issue/invoice/detail/${id}`,
    method: 'get',
    params
  });
}

// 开票申请-获取纳税人信息
export function getTaxpayerInfo(id) {
  return request({
    url: `admin/issue/invoice/taxpayer/info/${id}`,
    method: 'get'
  });
}

// 开票申请-获取纳税人列表
export function getTaxpayerList(params) {
  return request({
    url: 'admin/issue/invoice/taxpayerList',
    method: 'get',
    params
  });
}

// 开票申请-获取订单所关联合同
export function getOrderRelationContract(data) {
  return request({
    url: 'admin/issue/invoice/getOrderRelationContract',
    method: 'post',
    data
  });
}

// 开票申请-历史开票列表
export function getIssueInvoiceHistoryList(params) {
  return request({
    url: 'admin/issue/invoice/history/list',
    method: 'get',
    params
  });
}

// 开票申请-保存开票
export function storeIssueInvoiceInfo(data) {
  return request({
    url: 'admin/issue/invoice/info/store',
    method: 'post',
    data
  });
}

// 开票申请-保存到账流水
export function storeIssueFinance(id, data) {
  return request({
    url: `admin/issue/invoice/relFinanceTxn/${id}`,
    method: 'put',
    data
  });
}

// 审批流程-提交表单
export function formSubmitIssueInvoice(data) {
  return request({
    url: 'admin/issue/invoice/formSubmit',
    method: 'post',
    data
  });
}

// 流程审批
export function issueInvoiceProcessAudit(data) {
  return request({
    url: '/admin/issue/invoice/process/audit',
    method: 'post',
    data
  });
}

// 流程 - 撤销
export function issueInvoiceProcessRevocation(data) {
  return request({
    url: '/admin/issue/invoice/process/revocation',
    method: 'post',
    data
  });
}

// 流程 - 撤回
export function issueInvoiceProcessRecall(data) {
  return request({
    url: '/admin/issue/invoice/process/recall',
    method: 'post',
    data
  });
}

// 发表评论
export function issueInvoiceCommentAdd(data) {
  return request({
    url: '/admin/invoiceApply/comments/add',
    method: 'post',
    data
  });
}

// 评论列表
export function getIssueInvoiceComments(params) {
  return request({
    url: '/admin/invoiceApply/comments/list',
    method: 'get',
    params
  });
}

// 开票模块-开票项目列表
export function getInvoiceProjectList(params) {
  return request({
    url: 'admin/issue/invoice/projects',
    method: 'get',
    params
  });
}

// 开票模块-我方抬头列表
export function getOurTitleList(params) {
  return request({
    url: 'admin/issue/invoice/ourTitles',
    method: 'get',
    params
  });
}

// 开票模块-发票类型列表
export function getInvoiceTypes(params) {
  return request({
    url: 'admin/issue/invoice/types',
    method: 'get',
    params
  });
}

// 开票创建-发票类型列表
export function getIssueInvoiceTypes(params) {
  return request({
    url: 'admin/invoice/types',
    method: 'get',
    params
  });
}

// 开票创建-开票项目列表
export function getIssueInvoiceProjectList(params) {
  return request({
    url: 'admin/invoice/project/list',
    method: 'get',
    params
  });
}

// 开票创建-我方抬头列表
export function getIssueOurTitleList(params) {
  return request({
    url: 'admin/invoice/ourTitle/list',
    method: 'get',
    params
  });
}

export function getIssueStatistics(params) {
  return request({
    url: 'admin/issue/invoice/statistics',
    method: 'get',
    params
  });
}
